package com.hydra.wiki.parameter.service;

import com.hydra.wiki.core.auth.domain.LoginUser;
import com.hydra.wiki.parameter.domain.AloneParameter;
import com.hydra.wiki.parameter.exception.KeyExistException;

import java.util.List;
import java.util.Map;


public interface ParameterServiceInter {
    public final String CURRENCY_YES = "0";
    public final String CURRENCY_USER = "1";
    public final String TYPE_GENERAL = "0";
    public final String TYPE_DECORDE = "1";
    public final String TYPE_MD5 = "2";

    public void setValue(String key, String pValue,
                         LoginUser aloneUser);

    public void setUserValue(String key, String pValue,
                             LoginUser aloneUser);

    /**
     * 获得所有系统参数
     *
     * @return
     */
    public List<Map<String, Object>> getAllParameters();

    /**
     * 获得允许用户自定义的系统参数
     *
     * @return
     */
    public List<Map<String, Object>> getUserParameters(
            String userid);

    public String getValue(String key, String userId);

    public String getValue(String key);

    public AloneParameter insertEntity(AloneParameter entity, String domain,
                                       LoginUser aloneUser) throws KeyExistException;

    public void deleteEntity(String parameterId, LoginUser user);

    public AloneParameter editEntity(AloneParameter entity, LoginUser aloneUser);

    /**
     * 强制刷新配置集合(刷新参数缓存)
     */
    public boolean refreshCache();

    public List<Map<String, Object>> getTransParamList(String domainType);

    /**
     * 验证是否是重复key
     *
     * @param paramKey       ：“参数键”名称
     * @param excludeParamId ：要排除的系统参数ID
     * @return 重复：true；不重复：false
     *
     * @time 2012-9-7 下午01:00:14
     */
    public boolean isRepeatKey(String paramKey, String excludeParamId);

    /**
     * 根据key查找实体
     *
     * @param paramKey 参数键
     * @return
     *
     * @time 2012-9-12 下午05:59:18
     */
    public AloneParameter findEntityByKey(String paramKey);

    /**
     * @param id
     * @return
     */
    public AloneParameter getEntity(String parameterId);
}
